﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.Customers>" %>
<%@ Import Namespace="CRM.Resourses" %>

<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdLegalEntities";
                                        settings.KeyFieldName = "IdLegalEntity";

                                        settings.CallbackRouteValues =
                                          new { Controller = "Customers", Action = "CustomerLegalEntities", customerId = Model.IdCustomer };
                                        settings.SettingsPager.PageSize = 20;
                                       // settings.Width = Unit.Percentage(100);
                        
                                        settings.Settings.ShowGroupPanel = true;
                                        settings.Settings.ShowFilterRow = true;
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.LegalEntityName;
                                            column.FieldName = "Name";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.LegalEntityNUmberInSAP;
                                            column.FieldName = "NumberInSAP";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.OwnershipPattern;
                                            column.FieldName = "OwnerShipPatternLocalized";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.IsForContract;
                                            column.FieldName = "IsForContract";
                                            column.ColumnType = MVCxGridViewColumnType.CheckBox;
                                        });
                                        
                                    }

    ).Bind(Model.LegalEntities).GetHtml();               %>